import request from '@/request';

export const getCategory = function <U>(): Promise<U> {
    return request({
        method: 'get',
        url: '/category/list',
    });
};

export const fetchEditCategory = function <T, U>(id: string, data: T): Promise<U> {
    return request({
        method: 'post',
        url: '/category/update/' + id,
        data,
    });
};

export const fetchCreateCategory = function <T, U>(data: T): Promise<U> {
    return request({
        method: 'post',
        url: '/category/create',
        data,
    });
};

export const fetchDeleteCategory = function <U>(id: string): Promise<U> {
    return request({
        method: 'delete',
        url: '/category/delete/' + id,
    });
};
